<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>{$meta_title}</h2>
    </div>
    <form action="{:U('save')}" method="post" class="form-horizontal">
        <div class="form-item">
            <label class="item-label">课程名<span class="check-tips"></span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="title" value="{$data.title}">
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">简介<span class="check-tips"></span></label>
            <div class="controls">
                <label class="textarea input-large">
                    <textarea name="introduction">{$data.introduction}</textarea>
                </label>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">课程类型<span class="check-tips"></span></label>
            <div class="controls">
                <volist name="_type" id="vo" key="k">
                    <label class="radio"><input type="radio" name="type" value="{$k}" <php>if($k==$data['type'])echo 'checked';</php> >{$vo}</label>
                </volist>
            </div>
        </div>
        <div class="form-item">
            <label class="item-label">单节课费用<span class="check-tips">（元/课时）</span></label>
            <div class="controls">
                <input type="text" class="text input-large" name="fee" value="{$data.fee}"  onkeyup="clearNoNum(this)">
            </div>
        </div>

        <div class="form-item">
            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
        </div>
        <input type="hidden"  name="id" value="{$data.id}" >
    </form>
</block>

<block name="script">
    <script type="text/javascript">
        function clearNoNum(obj)
        {
            obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符
            obj.value = obj.value.replace(/^\./g,"");  //验证第一个字符是数字而不是.
            obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的.
            obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
        }
        //导航高亮
        highlight_subnav('{:U('Course/add')}');
    </script>
</block>
